package com.dodoke.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dodoke.entity.RetailRoute;
import com.dodoke.mapper.RetailRouteMapper;
import com.dodoke.service.IRetailRouteService;
import com.dodoke.vo.RetailRouteAllListVO;
import com.dodoke.vo.RetailRouteListVO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 线路管理业务实现
 */
@Service
public class RetailRouteServiceImpl extends ServiceImpl<RetailRouteMapper, RetailRoute> implements IRetailRouteService {
    @Resource
    private RetailRouteMapper retailRouteMapper;

    /**
     * 线路管理分页列表
     *
     * @param currentPage 当前页码
     * @param pageSize    每页显示条数
     * @param retailRoute 模糊查询条件
     * @return
     */
    @Override
    public Page<RetailRouteListVO> getListByPage(Integer currentPage, Integer pageSize, RetailRoute retailRoute) {
        Page<RetailRouteListVO> page = new Page<>(currentPage, pageSize);
        Page<RetailRouteListVO> pageByVO = retailRouteMapper.selectByList(page, retailRoute);
        return pageByVO;
    }

    /**
     * 获取所有路线列表
     *
     * @return
     */
    @Override
    public List<RetailRouteAllListVO> getAllList() {
        return retailRouteMapper.selectAllList();
    }
}
